import $state from '@/uni_modules/uni-im/sdk/state/index.js';
import uniIm from '@/uni_modules/uni-im/sdk/index.js';
export default async (res) => {
	console.log('进入通知处理模块');
  res.data.create_time = Date.now()
  res.data.is_read = res.data.is_read || false
  console.log('res.data notification.add', res.data)
  res.data._id = res.data.payload.notificationId
  const notificationData = res.data
  delete res.data.payload.notificationId
  delete res.data.unipush_version
  $state.notification.add(res.data)
  
  // 此以下为新续写的代码
  // 续写处理逻辑 __WJF
  switch (notificationData.payload.subType) {
	  case "uni-im-friend-add":
	    await uniIm.conversation.loadMore()
	    await uniIm.friend.loadMore()
	    break;
	  
	  default:
	    break;
  }
}